package com.caipiao.crawler.run;

import com.caipiao.constant.CrawlerConstants;
import com.caipiao.crawler.daletou.DaletouResultPage;
import com.caipiao.crawler.daletou.DaletouResultPipeline;
import us.codecraft.webmagic.Spider;

import java.util.ArrayList;
import java.util.List;

public class LotteryNumberRun {

    public void run(int type) {
       if(type==0){
           Daletou daletou = new Daletou();
           daletou.run();
//           daletou.runHistory();

       }else if(type==1){
           Qixingcai qixingcai = new Qixingcai();
           qixingcai.run();
       }else if(type==2||type==3){
           Pailie pailie = new Pailie();
           pailie.run();
           pailie.runSalesAndPool();
       }else if(type==4){
           Shengfucang shengfucang = new Shengfucang();
           shengfucang.runNowMatch();
           shengfucang.run();
           shengfucang.runSaleDetail();
       }else if(type==5){
           Jingqiucai jingqiucai = new Jingqiucai();
           jingqiucai.runNowMatch();
           jingqiucai.run();
       }
//        List<String> urls = new ArrayList<String>();
//        urls.add(CrawlerConstants.DALETOU_HISTORY_URL);
//        Spider.create(new DaletouResultPage())
//                .addUrl( urls.toArray(new String[0]))
//                .addPipeline(new DaletouResultPipeline())
//                .thread(4)
//                .run();
    }

    public void runHistory(int type) {
        if(type==0){
            Daletou daletou = new Daletou();
            daletou.runHistory();
        }else if(type==1){
            Qixingcai qixingcai = new Qixingcai();
            qixingcai.runHistory();
        }else if(type==2||type==3){
            Pailie pailie = new Pailie();
            pailie.runHistory();
        }else if(type==4){
            Shengfucang shengfucang = new Shengfucang();
            shengfucang.runHistory();
        }else if(type==5){
            Jingqiucai jingqiucai = new Jingqiucai();
            jingqiucai.runHistory();
        }
    }
}
